<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>What makes a currency? - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.currency.description.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.currency.description.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.currency.options.html">Options for currencies</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.currency.html">Zend_Currency</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.currency.position.html">Where is the currency?</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.currency.description" class="section"><div class="info"><h1 class="title">What makes a currency?</h1></div>
    

    <p class="para">
        The currency consists of several informations. A name, a abbreviation and a sign. Each
        of these could be relevant to be displayed, but only one at the same time. It would not
        be a good practice to display something like &quot;USD 1.000 $&quot;.
    </p>

    <p class="para">
        Therefor <span class="classname">Zend_Currency</span> supports the definition of the currency
        information which has to be rendered. The following constants can be used:
    </p>

    <table id="zend.currency.description.table-1" class="doctable table"><div class="info"><caption><b>Rendered informations for a currency</b></caption></div>
        

        
            <thead valign="middle">
                <tr valign="middle">
                    <th>Constant</th>
                    <th>Description</th>
                </tr>

            </thead>


            <tbody valign="middle" class="tbody">
                <tr valign="middle">
                    <td align="left"><b><tt>NO_SYMBOL</tt></b></td>
                    <td align="left">No currency representation will be rendered at all</td>
                </tr>


                <tr valign="middle">
                    <td align="left"><b><tt>USE_SYMBOL</tt></b></td>

                    <td align="left">
                        The currency symbol will be rendered. For US Dollar this would be &#039;$&#039;
                    </td>
                </tr>


                <tr valign="middle">
                    <td align="left"><b><tt>USE_SHORTNAME</tt></b></td>

                    <td align="left">
                        The abbreviation for this currency will be rendered. For US Dollar this
                        would be &#039;USD&#039;. Most abbreviations consist of 3 characters
                    </td>
                </tr>


                <tr valign="middle">
                    <td align="left"><b><tt>USE_NAME</tt></b></td>

                    <td align="left">
                        The full name for this currency will be rendered. For US Dollar the full
                        name would be &quot;US Dollar&quot;
                    </td>
                </tr>

            </tbody>
        
    </table>


    <div class="example" id="zend.currency.description.example-1"><div class="info"><p><b>Example #1 Selecting the currency description</b></p></div>
        

        <div class="example-contents"><p>
            Let&#039;s assume that your client has again set &quot;en_US&quot; as locale. Using no option the
            returned value could look like this:
        </p></div>

        <pre class="programlisting brush: php">
$currency = new Zend_Currency(
    array(
        &#039;value&#039; =&gt; 100,
    )
);

print $currency; // Could return &#039;$ 100&#039;
</pre>


        <div class="example-contents"><p>
            By giving the proper option you can define what information which has to be
            rendered.
        </p></div>

        <pre class="programlisting brush: php">
$currency = new Zend_Currency(
    array(
        &#039;value&#039;   =&gt; 100,
        &#039;display&#039; =&gt; Zend_Currency::USE_SHORTNAME,
    )
);

print $currency; // Could return &#039;USD 100&#039;
</pre>


        <div class="example-contents"><p>
             Without providing the <span class="property">display</span> the currency sign will be used
            when rendering the object. When the currency has no sign, the abbreviation will be
            used as replacement.
        </p></div>
    </div>

    <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Not all currencies have signs</b><br /></span>
        

        <p class="para">
            You should note that not all currencies have default currency signs. This means,
            that when there is no default sign, and you set the sign to be rendered, you will
            not have a rendered currency at all because the sign is an empty string.
        </p>
    </p></blockquote>

    <p class="para">
        Sometimes it is necessary to change the default informations. You can set each of the
        three currency informations independently by giving the proper option. See the following
        example.
    </p>

    <div class="example" id="zend.currency.description.example-2"><div class="info"><p><b>Example #2 Changing the currency description</b></p></div>
        

        <div class="example-contents"><p>
            Let&#039;s assume that your client has again set &quot;en_US&quot; as locale. But now we don&#039;t want
            to use the default settings but set our own description. This can simply be done
            providing the proper option:
        </p></div>

        <pre class="programlisting brush: php">
$currency = new Zend_Currency(
    array(
        &#039;value&#039; =&gt; 100,
        &#039;name&#039;  =&gt; &#039;Dollar&#039;,
    )
);

print $currency; // Could return &#039;Dollar 100&#039;
</pre>


        <div class="example-contents"><p>
            You could also set a sign or an abbreviations yourself.
        </p></div>

        <pre class="programlisting brush: php">
$currency = new Zend_Currency(
    array(
        &#039;value&#039;    =&gt; 100,
        &#039;symbol&#039; =&gt; &#039;$$$&#039;,
    )
);

print $currency; // Could return &#039;$$$ 100&#039;
</pre>

    </div>

    <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Automatic display settings</b><br /></span>
        

        <p class="para">
            When you set a name, abbreviation or sign yourself, than this new information will
            automatically be set to be rendered. This simplification prevents you from setting
            the proper <span class="property">display</span> option when you set a information.
        </p>

        <p class="para">
            So using the <span class="property">sign</span> option you can omit
            <span class="property">display</span> and don&#039;t neet to setting it to
            &#039;<b><tt>USE_SYMBOL</tt></b>&#039;.
        </p>
    </p></blockquote>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.currency.options.html">Options for currencies</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.currency.html">Zend_Currency</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.currency.position.html">Where is the currency?</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.currency.html">Zend_Currency</a></li>
  <li><a href="zend.currency.introduction.html">Introduction to Zend_Currency</a></li>
  <li><a href="zend.currency.usage.html">Using Zend_Currency</a></li>
  <li><a href="zend.currency.options.html">Options for currencies</a></li>
  <li class="active"><a href="zend.currency.description.html">What makes a currency?</a></li>
  <li><a href="zend.currency.position.html">Where is the currency?</a></li>
  <li><a href="zend.currency.number.html">How does the currency look like?</a></li>
  <li><a href="zend.currency.value.html">How much is my currency?</a></li>
  <li><a href="zend.currency.calculation.html">Calculating with currencies</a></li>
  <li><a href="zend.currency.exchange.html">Exchanging currencies</a></li>
  <li><a href="zend.currency.additional.html">Additional informations on Zend_Currency</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>